package test.tuanzi;

import java.util.Arrays;
import java.util.Scanner;

/**
 * @Description 
 * @Author Firenut
 * @Date 2023-08-26 11:29
 */
public class T3 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int k = in.nextInt();

        int[] nums = new int[n];
        Arrays.sort(nums);
        for (int i = 0; i < k; i++) {
            int last = n - 1 - i;
            nums[last - 1] = nums[last] * nums[last - 1];
            nums[last] = 1;
        }
        int sum = 0;
        for (int i = 0; i < nums.length; i++) {
            sum += nums[i];
        }
        System.out.println(sum);
    }
}